package my.jwds.p2042;

public class AreNumbersAscending {
    public static void main(String[] args) {
        AreNumbersAscending obj = new AreNumbersAscending();
        System.out.println(obj.areNumbersAscending("1 2"));
    }
    
    
    public boolean areNumbersAscending(String s) {
        int num = Integer.MIN_VALUE;
        int now = 0;
        for (int i = 0; i < s.length(); i++) {
            int charToInt = s.charAt(i)-'0';
            if (charToInt >= 0 && charToInt <= 9){
                now = now*10 + charToInt;
            }else if (now != 0){
                if (num >= now){
                    return false;
                }
                num = now;
                now = 0;
            }
        }

        return now==0 || num < now ;
    }
}
